From: Natalie Boehm Date: Wed, 27 Sep 2017 19:08:17 +0000 (-0400) Subject: change add_owners to return a string and transmit the status message passed from... X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~6^2~29^2~1 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=321c0cd3837ce8fc86fe0ac1807e4cf66abda3fa;p=cargo.git change add_owners to return a string and transmit the status message passed from the owner_add function in crates.io --- diff --git a/src/crates-io/lib.rs b/src/crates-io/lib.rs index 56ff3b275..c2a845860 100644 --- a/src/crates-io/lib.rs +++ b/src/crates-io/lib.rs @@ -116,6 +116,7 @@ pub struct Warnings { } #[derive(Deserialize)] struct R { ok: bool } +#[derive(Deserialize)] struct OwnerResponse { ok: String } #[derive(Deserialize)] struct ApiErrorList { errors: Vec } #[derive(Deserialize)] struct ApiError { detail: String } #[derive(Serialize)] struct OwnersReq<'a> { users: &'a [&'a str] } @@ -141,16 +142,14 @@ impl Registry { let body = serde_json::to_string(&OwnersReq { users: owners })?; let body = self.put(format!("/crates/{}/owners", krate), body.as_bytes())?; - //assert!(serde_json::from_str::(&body)?.ok); - //Ok(()) - Ok(body) + Ok(serde_json::from_str::(&body)?.ok) } pub fn remove_owners(&mut self, krate: &str, owners: &[&str]) -> Result<()> { let body = serde_json::to_string(&OwnersReq { users: owners })?; let body = self.delete(format!("/crates/{}/owners", krate), Some(body.as_bytes()))?; - assert!(serde_json::from_str::(&body)?.ok); + serde_json::from_str::(&body)?; Ok(()) }